package Vamos;
class Person implements Cloneable {
    public String name;

    public Person(String name) {
        this.name = name;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person1 = new Person("zhangsan");
        //通过Person引用来克隆一个对象
        Person person2 = (Person) person1.clone();
        System.out.println(person2.name);
    }
}
